<template>
  <div>
    <el-row class="lock-btn">
      <el-input
        v-model="queryParams.mac"
        style="width: 250px; float: left"
        clearable
        placeholder="请输入mac"
        @clear="reload"
      ></el-input>
      <el-input
        v-model="queryParams.userId"
        style="width: 250px; float: left; margin-left: 5px"
        clearable
        placeholder="请输入openId"
        @clear="reload"
      ></el-input>
      <el-input
        v-model="queryParams.phone"
        style="width: 250px; float: left; margin-left: 5px"
        clearable
        placeholder="请输入phone"
        @clear="reload"
      ></el-input>
      <el-button-group style="margin-left: 5px">
        <el-button size="medium" type="primary" @click="queryBtn" round
          >搜索</el-button
        >
      </el-button-group>
      <!-- <el-checkbox
        style="margin-top: 10px; margin-left: 30px"
        v-model="checked"
        @change="checkValue"
        >未结算订单</el-checkbox
      > -->

   <el-select v-model="checked" @change="checkValue"  placeholder="">
    <el-option
      
      v-for="item in options"
      :key="item.value"
      :label="item.label"
      :value="item.value">
    </el-option>
  </el-select>



    </el-row>
    <el-row style="box-shadow: rgb(205 205 205) 1px 1px 8px;">
      <el-col :span="24">
        <el-table
          :header-cell-style="{ background: '#ecf3fd',color:'#000000' }" 
          highlight-current-row 
          ref="lcredepositrequestTable"
          v-loading="loading"
          :data="list"
          :stripe="true"
          :row-key="'id'"
          :max-height="clientHeight"
          :height="clientHeight"
          @selection-change="handleTableChange"
        >
          <!-- <el-table-column
            prop="id"
            label="id"
            width="100"
            sortable
            align="center"
          >
          </el-table-column> -->
          <el-table-column
            prop="userId"
            label="open_id"
            width="160"
            sortable
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="amount"
            label="支付金额"
            width="60"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="currentNum"
            label="充电量"
            width="50"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="startTime"
            label="充电开始时间"
            width="110"
            align="center"
            sortable
          >
          </el-table-column>
          <el-table-column
            prop="endTime"
            label="充电结束时间"
            width="110"
            align="center"
          >
          </el-table-column>
          <el-table-column prop="status" label="状态" align="center">
            <template slot-scope="scope">
              <el-tag
                v-if="scope.row.status == '1'"
                size="medium"
                type="info"
                effect="dark"
                >空闲</el-tag
              >
              <el-tag
                v-else-if="scope.row.status == '2'"
                size="medium"
                type="success"
                effect="dark"
                >充电中</el-tag
              >
              <el-tag
                v-else-if="scope.row.status == '3'"
                size="medium"
                type="warning"
                effect="dark"
                >等待启动</el-tag
              >
              <el-tag
                v-else-if="scope.row.status == '4'"
                size="medium"
                type="warning"
                effect="dark"
                >超时启动</el-tag
              >
            </template>
          </el-table-column>

          <el-table-column prop="orderStatus" label="订单状态" align="center">
            <template slot-scope="scope">
              <el-tag
                v-if="scope.row.orderStatus == 0"
                size="medium"
                type="success"
                effect="dark"
                style="background:#409EFF ;"
                >正常</el-tag
              >
              <el-tag
               
                v-else-if="scope.row.orderStatus == 1"
                size="medium"
                type="danger"
                effect="dark"
                >挂起</el-tag
              >
      
            </template>
          </el-table-column>
          <!-- 1 ： 空闲，2：充电中，3：等待启动 4:超时 -->
          
          <el-table-column
            prop="lockMac"
            label="mac地址"
            width="120"
            align="center"
          >
          </el-table-column>
          <el-table-column prop="isOccupied" label="是否占位" align="center" width="80">
            <template slot-scope="scope">
              <el-tag
                v-if="scope.row.isOccupied == true"
                size="medium"
                type="danger"
                effect="dark"
                >是</el-tag
              >
              <el-tag
                v-else-if="scope.row.isOccupied == false"
                size="medium"
                type="success"
                effect="dark"
                >否</el-tag
              >
            </template>
          </el-table-column>

          <el-table-column
            prop="leaveTime"
            label="离开时间"
            width="100"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="consumeFee"
            label="消费金额"
            width="60"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="occupiedFee"
            label="占位费金额"
            width="70"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="occupiedTime"
            label="占位时间"
            width="60"
            align="center"
          >
          </el-table-column>
      
          <el-table-column
            prop="electricityNum"
            label="历史总电量"
            width="100"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="firstElectricityNum"
            label="尖"
            width="60"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="secondElectricityNum"
            label="峰"
            width="60"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="thirdElectricityNum"
            label="平"
            width="60"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="fourthElectricityNum"
            label="谷"
            width="60"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="lockIp"
            label="ip地址"
            width="100"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="payWays"
            label="支付方式"
            width="100"
            align="center"
          >
            <template slot-scope="scope">
              <el-tag
                v-if="scope.row.payWays == 0"
                size="medium"
                type="success"
                effect="dark"
                >微信</el-tag
              >
              <el-tag
                v-else-if="scope.row.payWays == 1"
                size="medium"
                type="warning"
                effect="dark"
                >余额</el-tag
              >
              <el-tag
                v-else-if="scope.row.payWays == 2"
                size="medium"
                type="error"
                effect="dark"
                >充值余额</el-tag
              >
              <el-tag v-else size="medium" type="info" effect="dark"
                >其他</el-tag
              >
            </template>
          </el-table-column>
          <el-table-column
            prop="stopReason"
            label="停止原因"
            width="100"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="exceptionCode"
            label="异常代码"
            width="100"
            align="center"
          >
          </el-table-column>
          <el-table-column
            prop="payOccTime"
            label="占位支付时间"
            width="110"
            align="center"
          >
          </el-table-column>

          <el-table-column
            prop="orderId"
            label="订单号"
            width="140"
            align="center"
          >
          </el-table-column>

          <el-table-column
            label="订单处理"
            width="130"
            height="200"
            fixed="right"
            align="center"
          >
            <template slot-scope="scope">
              <!-- <el-button
                size="mini"
                type="primary"
                @click="editBtn(scope.$index, scope.row)"
                title="处理"
                >处理</el-button
              > -->

              <el-tag
                v-if="scope.row.leaveTime == null || scope.row.leaveTime == ''"
                size="medium"
                type="primary"
                effect="dark"
                @click="editBtn(scope.$index, scope.row)"
                style="cursor:pointer"
                >处理</el-tag>
              <el-tag 
                v-else
                size="medium"
                type="info"
                effect="dark"
                >处理</el-tag
              >
 
                <el-tag
                v-if="scope.row.orderStatus == 0"
                size="medium"
                type="success"
                effect="dark"
                @click="editBtn2(scope.$index, scope.row)"
                style="cursor:pointer"
                >挂起</el-tag>
              <el-tag 
                v-else
                size="medium"
                type="danger"
                style="cursor:pointer"
                @click="editBtn2(scope.$index, scope.row)"
                effect="dark"
                >解挂</el-tag
              >

            </template>
          </el-table-column>


          <el-table-column
            label="设备处理"
            width="190"
            height="200"
            align="center"
          >
            <template slot-scope="scope">
              <el-tag
                v-if="scope.row.isShowOcc == 1 || scope.row.isShowOcc == 2"
                size="medium"
                type="success"
                effect="dark"
                @click="editBtn3(scope.$index, scope.row)"
                style="cursor:pointer"
                >退占位费</el-tag>
              <el-tag 
                v-else
                size="medium"
                disabled="trye"
                type="info"
                effect="dark"
                >退占位费</el-tag>

              <el-button
                size="mini"
                type="danger"
                @click="editBtn4(scope.$index, scope.row)"
                title="设备处理"
                >设备处理</el-button>
                
                
             
            </template>

            
          </el-table-column>



        </el-table>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="24" class="page-tool">
        <el-pagination
          layout="total,sizes,prev, pager,next,jumper"
          :page-size="pageSize"
          :total="total"
          :page-sizes="[10, 20, 30, 40, 100]"
          @size-change="handlePageChange"
          @current-change="handleNoChange"
        >
        </el-pagination>
      </el-col>
    </el-row>

    <el-dialog
      title="处理"
      :visible.sync="addDialog"
      :width="'800px'"
      :destroy-on-close="true"
    >
      <el-form :model="feeForm" ref="addForm">
        <el-row>
          <el-col span="11">
            <el-form-item label="id" :label-width="labelWidth" prop="id">
              <el-input
                v-model="feeForm.id"
                disabled
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item
              label="open_id"
              :label-width="labelWidth"
              prop="userId"
            >
              <el-input
                v-model="feeForm.userId"
                disabled
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col span="11">
            <el-form-item
              label="订单号"
              :label-width="labelWidth"
              prop="orderId"
            >
              <el-input
                v-model="feeForm.orderId"
                disabled
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item
              label="充电量"
              :label-width="labelWidth"
            >
              <el-input
                v-model="feeForm.currentNum"
                auto-complete="off"
                disabled
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col span="11">
            <el-form-item
              label="充电开始时间"
              :label-width="labelWidth"
              prop="startTime"
            >
              <el-date-picker
                v-model="feeForm.startTime"
                value-format="yyyy-MM-dd HH:mm:ss"
                style="width: 250px"
                type="datetime"
                placeholder=""
              ></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item
              label="充电结束时间"
              :label-width="labelWidth"
              prop="endTime"
            >
              <el-date-picker
                v-model="feeForm.endTime"
                value-format="yyyy-MM-dd HH:mm:ss"
                style="width: 250px"
                type="datetime"
                placeholder=""
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col span="11">
            <el-form-item
              label="ip地址"
              :label-width="labelWidth"
              prop="lockIp"
            >
              <el-input v-model="feeForm.lockIp" auto-complete="off"></el-input>
            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item
              label="mac地址"
              :label-width="labelWidth"
              prop="lockMac"
            >
              <el-input
                v-model="feeForm.lockMac"
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col span="11">
            <el-form-item
              label="是否占位"
              :label-width="labelWidth"
              prop="isOccupied"
            >
              <el-select v-model="isOccupiedUpdate" placeholder="">
                <el-option key="0" label="是" :value="true"></el-option>
                <el-option key="1" label="否" :value="false"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item
              label="离开时间"
              :label-width="labelWidth"
              prop="leaveTime"
            >
              <el-input
                disabled
                v-model="leaveTimeTemp"
                value-format="yyyy-MM-dd HH:mm:ss"
                style="width: 250px"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col span="11">
            <el-form-item
              label="消费金额"
              :label-width="labelWidth"
              prop="consumeFee"
            >
              <el-input
                v-model="feeForm.consumeFee"
                auto-complete="off"
                disabled
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item
              label="占位费金额"
              :label-width="labelWidth"
              prop="occupiedFee"
            >
              <el-input
                style="width: 203px"
                v-model="feeForm.occupiedFee"
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col span="11">
            <el-form-item
              label="占位时间"
              :label-width="labelWidth"
              prop="occupiedTime"
            >
              <el-input
                v-model="feeForm.occupiedTime"
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item
              label="支付金额"
              :label-width="labelWidth"
              prop="amount"
            >
              <el-input v-model="feeForm.amount" auto-complete="off"></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col span="11">
            <el-form-item
              label="尖"
              :label-width="labelWidth"
              prop="firstElectricityNum"
            >
              <el-input
                v-model="feeForm.firstElectricityNum"
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item
              label="峰"
              :label-width="labelWidth"
              prop="secondElectricityNum"
            >
              <el-input
                v-model="feeForm.secondElectricityNum"
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col span="11">
            <el-form-item
              label="平"
              :label-width="labelWidth"
              prop="thirdElectricityNum"
            >
              <el-input
                v-model="feeForm.thirdElectricityNum"
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item
              label="谷"
              :label-width="labelWidth"
              prop="fourthElectricityNum"
            >
              <el-input
                v-model="feeForm.fourthElectricityNum"
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col span="11">
            <el-form-item
              label="历史总电量"
              :label-width="labelWidth"
              prop="electricityNum"
            >
              <el-input
                v-model="feeForm.electricityNum"
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item
              label="支付方式"
              :label-width="labelWidth"
              prop="payWays"
            >
              <el-tag
                v-if="feeForm.payWays == 0"
                size="medium"
                type="success"
                effect="dark"
                >微信</el-tag
              >
              <el-tag
                v-else-if="feeForm.payWays == 1"
                size="medium"
                type="warning"
                effect="dark"
                >余额</el-tag
              >
              <el-tag
                v-else-if="feeForm.payWays == 2"
                size="medium"
                type="error"
                effect="dark"
                >充值余额</el-tag
              >
              <el-tag v-else size="medium" type="info" effect="dark"
                >其他</el-tag
              >
            </el-form-item>

            <!-- <el-table-column prop="payWays" label="支付方式" width="100" align="center">
            <template slot-scope="scope">
              <el-tag v-if="scope.row.payWays == 0" size="medium" type="success" effect="dark">微信</el-tag>
              <el-tag v-else-if="scope.row.payWays == 1" size="medium" type="warning" effect="dark">余额</el-tag>
              <el-tag v-else-if="scope.row.payWays == 2" size="medium" type="error" effect="dark">充值余额</el-tag>
              <el-tag v-else size="medium" type="info" effect="dark">其他</el-tag>
            </template>
          </el-table-column> -->
          </el-col>
           
        </el-row>

        <el-row>
          <el-col span="11">
            <el-form-item
              label="停止原因"
              :label-width="labelWidth"
              prop="stopReason"
            >
    
              <el-select v-model="feeForm.stopReason" placeholder="">
                <el-option key="0" label="0:无异常" :value="'0:无异常'"></el-option>
                <el-option key="1" label="1:用户主动结束充电" :value="'1:用户主动结束充电'"></el-option>
                <el-option key="2" label="2:充满自动停止" :value="'2:充满自动停止'"></el-option>
                <el-option key="3" label="3:充电桩下达停止命令" :value="'3:充电桩下达停止命令'"></el-option>
                <el-option key="4" label="4:紧急按钮触发" :value="'4:紧急按钮触发'"></el-option>
                <el-option key="5" label="5:异常停止" :value="'5:异常停止'"></el-option>
                <el-option key="6" label="99:充电桩启动失败" :value="'99:充电桩启动失败'"></el-option>
              </el-select>

            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item
              label="占位支付时间"
              :label-width="labelWidth"
              prop="payOccTime"
            >
              <el-date-picker
                v-model="feeForm.payOccTime"
                value-format="yyyy-MM-dd HH:mm:ss"
                style="width: 250px"
                type="datetime"
                placeholder=""
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col span="11">
            <el-form-item
              label="异常代码"
              :label-width="labelWidth"
              prop="exceptionCode"
            >

            <el-select v-model="feeForm.exceptionCode" placeholder="">
                <el-option key="0" label="0:无异常" :value="'0:无异常'"></el-option>
                <el-option key="1" label="1:用户取消" :value="'1:用户取消'"></el-option>
                <el-option key="2" label="2:充电桩启动失败" :value="'2:充电桩启动失败'"></el-option>
                <el-option key="3" label="3:用户无操作" :value="'3:用户无操作'"></el-option>
                <el-option key="4" label="4:急停按下" :value="'4:急停按下'"></el-option>
                <el-option key="5" label="5:欠压结束充电" :value="'5:欠压结束充电'"></el-option>
                <el-option key="6" label="6:过流结束充电" :value="'6:过流结束充电'"></el-option>
                <el-option key="7" label="7:485召表不通结束充电" :value="'7:485召表不通结束充电'"></el-option>
                <el-option key="8" label="8:充电枪断开结束充电" :value="'8:充电枪断开结束充电'"></el-option>
                <el-option key="9" label="9:过压结束充电" :value="'9:过压结束充电'"></el-option>
                <el-option key="10" label="10:硬件故障结束充电" :value="'10:硬件故障结束充电'"></el-option>
                <el-option key="11" label="11:漏电流故障结束充电" :value="'11:漏电流故障结束充电'"></el-option>
                <el-option key="12" label="12:余额不足结束充电" :value="'12:余额不足结束充电'"></el-option>
                <el-option key="13" label="13:断电结束充电" :value="'13:断电结束充电'"></el-option>
                <el-option key="14" label="14:CP非法电压结束充电" :value="'14:CP非法电压结束充电'"></el-option>
                <el-option key="15" label="15:交流接触器故障结束充电" :value="'15:交流接触器故障结束充电'"></el-option>
                <el-option key="16" label="16:充电桩过温结束充电" :value="'16:充电桩过温结束充电'"></el-option>
                <el-option key="17" label="17:充电枪过温结束充电" :value="'17:充电枪过温结束充电'"></el-option>
                <el-option key="18" label="18:从板通讯故障结束充电" :value="'18:从板通讯故障结束充电'"></el-option>
                <el-option key="19" label="19:电子锁故障结束充电" :value="'19:电子锁故障结束充电'"></el-option>
                <el-option key="20" label="20:防雷故障结束充电" :value="'20:防雷故障结束充电'"></el-option>
                <el-option key="21" label="21:电价读取故障结束充电" :value="'21:电价读取故障结束充电'"></el-option>
                <el-option key="22" label="22:掉电结束充电" :value="'22:掉电结束充电'"></el-option>
                <el-option key="23" label="23:电量上传失败" :value="'23:电量上传失败'"></el-option>
                <el-option key="24" label="24:使能后未插枪" :value="'24:使能后未插枪'"></el-option>
                <el-option key="25" label="25:使能后插枪S2未闭合" :value="'25:使能后插枪S2未闭合'"></el-option>
              </el-select>

            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item label="状态" :label-width="labelWidth" prop="status">
              <el-select v-model="feeForm.status" placeholder="">
                <el-option key="0" label="空闲" :value="1"></el-option>
                <el-option key="1" label="充电中" :value="2"></el-option>
                <el-option key="2" label="等待启动" :value="3"></el-option>
                <el-option key="3" label="超时启动" :value="4"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col span="18">
            <el-form-item
              label="处理原因"
              :label-width="labelWidth"
              prop="notes"
            >
              <!-- <el-input
                v-model="feeForm.notes"
                auto-complete="off"
                placeholder="处理原因不得少于6个汉字或12个英文/数字"
              ></el-input> -->

              <el-select v-model="feeForm.notes" placeholder="请选择处理原因" >
                <el-option key="0" label="车走未落杆" :value="0"></el-option>
                <el-option key="1" label="通讯异常" :value="1"></el-option>
                <el-option key="2" label="设备断电" :value="2"></el-option>
                <el-option key="3" label="充电失败" :value="3"></el-option>
                <el-option key="4" label="电量上传失败" :value="4"></el-option>
                <el-option key="5" label="其他" :value="5"></el-option>
              </el-select>

            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancle">取消</el-button>
        <el-button type="primary" @click="Channelcheck">处理</el-button>
      </div>
    </el-dialog>




    <el-dialog
      title="退款金额"
      :visible.sync="addDialog4"
      :width="'800px'"
      :destroy-on-close="true"
    >
      <el-form :model="feeForm" ref="addForm">
        <el-row>
          <el-col span="11">
            <el-form-item label="退款金额" :label-width="labelWidth" prop="id">
              <el-input
                v-model="OccAmount"
                disabled
                auto-complete="off"
              ></el-input>
              <i v-if="Math.abs(OccAmount)>0.1" style="font-size: 100px;position: absolute;top: -32px;left: 270px;color: red;" class="el-icon-error"></i>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="cancle4">关闭</el-button>
      </div>
    </el-dialog>



    <el-dialog
      title="退占位费"
      :visible.sync="addDialog2"
      :width="'800px'"
      :destroy-on-close="true"
    >
      <el-form :model="feeForm" ref="addForm">
       
        <el-row>
          <el-col span="11">
            <el-form-item label="id" :label-width="labelWidth" prop="id">
              <el-input
                v-model="feeForm.id"
                disabled
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item
              label="open_id"
              :label-width="labelWidth"
              prop="userId"
            >
              <el-input
                v-model="feeForm.userId"
                disabled
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col span="11">
            <el-form-item
              label="订单号"
              :label-width="labelWidth"
              prop="orderId"
            >
              <el-input
                v-model="feeForm.orderId"
                disabled
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>

          <el-col span="11">
            <el-form-item
              label="mac地址"
              :label-width="labelWidth"
              prop="lockMac"
            >
              <el-input
              disabled
                v-model="feeForm.lockMac"
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>


        </el-row>


        <el-row>
          <el-col span="11">
            <el-form-item
              label="占位时间"
              :label-width="labelWidth"
              prop="occupiedTime"
            >
              <el-input
          
                v-model="feeForm.occupiedTime"
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col> 
          <el-col span="12">
            <el-form-item
             
              label="占位费金额"
              :label-width="labelWidth"
              prop="occupiedFee"
            >
              <el-input
                v-model="feeForm.occupiedFee"
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>

        </el-row>

      <el-row>
          <el-col span="11">
            <el-form-item prop="feeForm.pay" label="是否缴纳" :label-width="labelWidth">
              <el-tag
            v-if="feeForm.occupiedFee == null || feeForm.occupiedFee == ''"
            size="medium"
            type="info"
            effect="dark"
            style="font-size: 14px"
            >无</el-tag
          >
          <el-tag
            v-else-if="feeForm.occupiedFee <= 0"
            size="medium"
            type="danger"
            effect="dark"
            style="font-size: 14px"
            >未缴纳</el-tag
          >
          <el-tag
            v-else-if="feeForm.occupiedFee > 0"
            size="medium"
            type="success"
            effect="dark"
            style="font-size: 14px"
            >已缴纳</el-tag
          >
         
          <el-tag v-else size="medium" type="Info" style="font-size: 14px">
            无
          </el-tag>
           </el-form-item>
          </el-col>

          <el-col span="12">
            <el-form-item
              label="退占位费次数"
              :label-width="labelWidth"
            >
              <el-input
               disabled
                v-model="refundCount"
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>


      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancle2">取消</el-button>
        <el-button type="primary" @click="Channelcheck2">退费</el-button>
      </div>
    </el-dialog>


    <el-dialog
      title="设备处理"
      :visible.sync="addDialog3"
      :width="'800px'"
      :destroy-on-close="true"
    >
      <el-form :model="feeForm" ref="addForm">
        
        
        <el-row>
          <el-col span="11">
            <el-form-item label="订单编号" :label-width="labelWidth" prop="faultNo">
              <el-input
                v-model="feeForm.faultNo"
                disabled
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col span="11">
            <el-form-item label="mac地址" :label-width="labelWidth" prop="lockMac">
              <el-input
                v-model="feeForm.lockMac"
                disabled
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item
              label="站点名称"
              :label-width="labelWidth"
              prop="lockName"
            >
              <el-input
                v-model="feeForm.lockName"
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col span="18">
            <el-form-item
              label="问题描述"
              :label-width="labelWidth"
              prop="faultDesc"
            >
              <el-input
                v-model="feeForm.faultDesc"
                type="textarea"
                :autosize="{ minRows: 3, maxRows: 5}"
                placeholder="请输入内容"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col span="18">
            <el-form-item
              label="拟解决方案"
              :label-width="labelWidth"
              prop="procMethod"
            >
              <el-input
              type="textarea"
                :autosize="{ minRows: 3, maxRows: 5}"
                placeholder="请输入内容"
                v-model="feeForm.procMethod"
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>


        </el-row>


        <el-row>
          <el-col span="12">
            <el-form-item label="是否上报" :label-width="labelWidth" prop="isReport">
       <el-checkbox
        style="margin-left: 30px"
        v-model="feeForm.isReport"
        @change="changeRepodt"
        >上报</el-checkbox>
            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item label="问题来源" :label-width="labelWidth" prop="faultSource">
              <el-select v-model="feeForm.faultSource" placeholder="请选择">
                <el-option key="0" label="主动上报" :value="0"></el-option>
                <el-option key="1" label="人工巡检" :value="1"></el-option>
                <el-option key="2" label="用户反馈" :value="2"></el-option>
                <el-option key="3" label="其他" :value="3"></el-option>
              </el-select>
            </el-form-item>
          </el-col>

        </el-row>
        <el-row>
        <el-col span="12">
          <el-form-item
              label="推送人员"
              :label-width="labelWidth"
              prop="opPerson"
            >
              <el-input
              type="textarea"
                :autosize="{ minRows: 2, maxRows: 3}"
                placeholder="请输入内容"
                v-model="feeForm.opPerson"
                auto-complete="off"
              ></el-input>
            </el-form-item>
          </el-col>
     
    
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancle3">取消</el-button>
        <el-button type="primary" @click="Channelcheck3">处理</el-button>
      </div>
    </el-dialog>


  </div>
</template>

<script>

import { getNickName, getTestUserName,getRoleCode } from "../../util/auth";
import {
  loadAbnormalOrderApi,
  loadAbnormalListApi,
  procRefundApi,
  loadAbnormalListlistHangup,
  setlockApi,
  hangUpExceptOrderApi,
  lcoccfeeprocApi,
  OccFeeProcApi,
  lcfaultprocApi
} from "../../api/lcredepositrequest.js";
import { loadParkfieldApi } from "../../api/parkfield";
import axios from 'axios';

export default {
  name: "lcredepositrequest",
  data: function () {
    return {
      clientHeight:
        Math.max(
          document.documentElement.scrollHeight,
          document.body.scrollHeight
        ) -
        132 -
        5 +
        10 -
        28,
      labelWidth: "100px",
      options: [{
          value: '0',
          label: '所有订单'
        }, {
          value: '1',
          label: '未结算订单'
        }, {
          value: '2',
          label: '挂起'
        }],
      loading: false,
      isOccupiedUpdate:false,
      dialogTitle: "",
      pageNo: 1,
      checked: '1',
      pageSize: 20,
      refundCount:'',
      OccAmount:'',
      checkVal:1,
      feeForm: {
        id: "",
        userId: "",
        amount: "",
        currentNum: "",
        startTime: "",
        endTime: "",
        status: "",
        lockIp: "",
        leaveTimeTemp:"",
        lockMac: "",
        isOccupied: false,
        leaveTime: "",
        consumeFee: "",
        occupiedFee: "",
        occupiedTime: "",
        orderId: "",
        faultNo:"",
        isReport:false,
        lockMac:"",
        lockName:"",
        faultDesc:"",
        addDialog4:false,
        procMethod:"",
        faultSource:0,
        opPerson:"",
        electricityNum: "",
        firstElectricityNum: "",
        secondElectricityNum: "",
        thirdElectricityNum: "",
        fourthElectricityNum: "",
        payWays: "",
        stopReason: "",
        exceptionCode: "",
        payOccTime: "",
        handleReason: "",
        notes:'',
        pay:''
      },
      ip:'',
      total: 0,
      multipleSelection: [],
      lcredepositrequests: [],
      roleCode:'',
      form: {},
      queryParams: {
        mac: null,
        userId: null,
        phone: null,
      },
      addDialog: false,
      addDialog2: false,
      addDialog3: false,
      parkfieldList: [],
      parkfieldId: "",
      status: "",
    };
  },
  methods: {
    editBtn(index, row) {
      let _this = this;
      // _this.$nextTick(() => {
      //   if (_this.$refs.form != undefined) {
      //     _this.$refs.form.resetFields();
      //   }
      // });
      _this.feeForm = row;
      if(row.leaveTime == null || row.leaveTime == ''){
        _this.localTime();
      }
      if(row.endTime == null || row.endTime == ''){
        _this.feeForm.endTime = _this.leaveTimeTemp
      }
      if(row.occupiedFee == null || row.occupiedFee == ''){
        _this.feeForm.occupiedFee = 0
      }

        _this.feeForm.status = 1

      
      _this.addDialog = true;
    },
    editBtn2(index, row) {
      let _this = this;

      if(row.orderStatus == 0){
        hangUpExceptOrderApi(
          {id: row.id,status:1}
        ).then((resp) => {
          _this.loading = true
          if (resp.errmsg === "ok") {            
            this.$nextTick(function () {
              _this.handleNoChange(_this.pageNo)
           });  
          }    
        });
      }else{
        hangUpExceptOrderApi(
          {id: row.id,status:0}
        ).then((resp) => {
          _this.loading = true
          if (resp.errmsg === "ok") {            
            this.$nextTick(function () {
              _this.handleNoChange(_this.pageNo)
           });  
          }    
        });
      }
     

    },
    editBtn3(index, row) {
      let _this = this;
      _this.$nextTick(() => {
        if (_this.$refs.form != undefined) {
          _this.$refs.form.resetFields();
        }
      });

      OccFeeProcApi(
          {openId: row.userId}
        ).then((resp) => {
          if (resp.errmsg === "ok") {

            console.log("0000000000000000000123",resp.data)
          
            this.refundCount = resp.data
          }
        });
     
      _this.feeForm = row;
      _this.addDialog2 = true;
      _this.getIP();
    },
    editBtn4(index, row) {
      var _this = this;
      _this.$nextTick(() => {
        if (_this.$refs.form != undefined) {
          _this.$refs.form.resetFields();
        }
      });
      console.log(row.faultNo)
      if(row.faultNo == undefined || row.faultNo == null || row.faultNo == ""){
        const now = new Date()
        let month = now.getMonth() + 1
        let day = now.getDate()
        let hour = now.getHours()
        let minutes = now.getMinutes()
        let seconds = now.getSeconds()
        let randomNumber = now.getFullYear().toString() + month.toString() + day + hour + minutes + seconds
        var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
        var randomString = "";
        for (var i = 0; i < 8; i++) {
          var randomIndex = Math.floor(Math.random() * chars.length);
          randomString += chars.charAt(randomIndex);
        }
        row.faultNo = randomNumber + randomString
      }
      _this.feeForm = row;
      _this.addDialog3 = true;
    },
    cancle(){
      let _this = this;
      _this.addDialog = false;
     
    },
    cancle2(){
      let _this = this;
      _this.addDialog2 = false;
     
    },
    cancle3(){
      let _this = this;
      _this.addDialog3 = false;
     
    },
    cancle4(){
      let _this = this;
      _this.addDialog4 = false;

      if (_this.checkVal == 1) {
        
        _this.checkVal = 1;
        _this.loading = true;
        loadAbnormalListApi(
          {pageNo: this.pageNo, pageSize: this.pageSize,roleCode:this.roleCode}
        ).then((resp) => {
          if (resp.errmsg === "ok") {
            // console.log(resp.data.dataList);
            _this.total = resp.data.totalNum;
            _this.list = resp.data.dataList;
          }
          setTimeout(() => {
            _this.loading = false;
          }, 1 * 1000);
        });
       
      }else if(_this.checkVal == 0)
      {
        this.checkVal = 0;
        this.loadAbnormalOrder(this.pageNo, this.pageSize);
      }else{
        let _this = this;
        _this.checkVal = 2;
        _this.loading = true;
        loadAbnormalListlistHangup().then((resp) =>{
          if (resp.errmsg === "ok") {
            let _this = this;
            // console.log(resp.data.dataList);
            _this.total = resp.data.totalNum;
            _this.list = resp.data.dataList;
          }
          setTimeout(() => {
            let _this = this;
            _this.loading = false;
          }, 1 * 1000);
        })
      }
     
    },
    changeRepodt(val){
    console.log("9898989898989898989",val)
    },
    checkValue(val) {

      let _this = this;
      _this.queryParams.mac = ""
      _this.queryParams.userId = ""
      _this.queryParams.phone = ""


      console.log(val)

      if (val == 1) {
        
        _this.checkVal = 1;
        _this.loading = true;
        loadAbnormalListApi(
          {pageNo: this.pageNo, pageSize: this.pageSize,roleCode:this.roleCode}
        ).then((resp) => {
          if (resp.errmsg === "ok") {
            // console.log(resp.data.dataList);
            _this.total = resp.data.totalNum;
            _this.list = resp.data.dataList;
          }
          setTimeout(() => {
            _this.loading = false;
          }, 1 * 1000);
        });
       
      }else if(val == 0)
      {
        this.checkVal = 0;
        this.loadAbnormalOrder(this.pageNo, this.pageSize);
      }else{
        let _this = this;
        _this.checkVal = 2;
        _this.loading = true;
        loadAbnormalListlistHangup().then((resp) =>{
          if (resp.errmsg === "ok") {
            let _this = this;
            // console.log(resp.data.dataList);
            _this.total = resp.data.totalNum;
            _this.list = resp.data.dataList;
          }
          setTimeout(() => {
            let _this = this;
            _this.loading = false;
          }, 1 * 1000);
        })
      }
    },
    reload(){
      this.loadAbnormalOrder(this.pageNo, this.pageSize);
    },
    getByteLen(val) {

      if(val != undefined || val != null){
      var len = 0;
      for (var i = 0; i < val.length; i++) {
        var a = val.charAt(i);
        if (a.match(/[^\x00-\xff]/ig) != null) {
          len += 2;
        }
        else {
          len += 1;
        }
      }
      return len;
    }else{
    

    }
    },



    Channelcheck() {
      var _this = this;


      var notes = "";

      if(_this.feeForm.notes == "0"){

         notes = "车走未落杆";

      }else if(_this.feeForm.notes == "1"){

         notes = "通讯异常";

      }else if(_this.feeForm.notes == "2"){

         notes = "设备断电";

        }else if(_this.feeForm.notes == "3"){

          notes = "充电失败";

          }else if(_this.feeForm.notes == "4"){

          notes = "电量上传失败";

          }else{

            notes = "其他";


          }


      const data = {
        id: _this.feeForm.id,
        userId: _this.feeForm.userId,
        amount: _this.feeForm.amount,
        currentNum: _this.feeForm.currentNum,
        startTime: _this.feeForm.startTime,
        endTime: _this.feeForm.endTime,
        status: _this.feeForm.status,
        lockIp: _this.feeForm.lockIp,
        lockMac: _this.feeForm.lockMac,
        isOccupied: _this.isOccupiedUpdate,
        leaveTime: _this.leaveTimeTemp,
        consumeFee: _this.feeForm.consumeFee,
        occupiedFee: _this.feeForm.occupiedFee,
        occupiedTime: _this.feeForm.occupiedTime,
        orderId: _this.feeForm.orderId,
        electricityNum: _this.feeForm.electricityNum,
        firstElectricityNum: _this.feeForm.firstElectricityNum,
        secondElectricityNum: _this.feeForm.secondElectricityNum,
        thirdElectricityNum: _this.feeForm.thirdElectricityNum,
        fourthElectricityNum: _this.feeForm.fourthElectricityNum,
        payWays: _this.feeForm.payWays,
        stopReason: _this.feeForm.stopReason,
        exceptionCode: _this.feeForm.exceptionCode,
        payOccTime: _this.feeForm.payOccTime,
        notes: notes,
        
      };



     if(_this.feeForm.id ==null || _this.feeForm.id ==''){alert("id不能为空！");return false;}
     if(_this.feeForm.userId ==null || _this.feeForm.userId ==''){alert("open_id不能为空！");return false;}
     if(_this.feeForm.orderId ==null || _this.feeForm.orderId ==''){alert("订单号不能为空！");return false;}
    //  if(_this.feeForm.currentNum !='0'){
    // //  if(_this.feeForm.currentNum =='' || _this.feeForm.currentNum ==null){alert("充电量不能为空！");return false;}}
     if(_this.feeForm.startTime ==null || _this.feeForm.startTime ==''){alert("充电开始时间不能为空！");return false;}
    //  if(_this.feeForm.endTime ==null || _this.feeForm.endTime ==''){alert("充电结束时间不能为空！");return false;}
     if(_this.feeForm.lockIp ==null || _this.feeForm.lockIp ==''){alert("ip地址不能为空！");return false;}
     if(_this.feeForm.lockMac ==null || _this.feeForm.lockMac ==''){alert("mac地址不能为空！");return false;}
     if(_this.feeForm.isOccupied !='0'){
     if(_this.feeForm.isOccupied ==null || _this.feeForm.isOccupied ==''){alert("是否占位不能为空值");return false;}}

    //  if(_this.feeForm.leaveTime ==null || _this.feeForm.leaveTime ==''){alert("离开时间不能为空！");return false;}
    //  if(_this.feeForm.consumeFee !='0'){
    //  if(_this.feeForm.consumeFee ==null || _this.feeForm.consumeFee ==''){alert("消费金额不能为空！");return false;}}
     if(_this.feeForm.occupiedFee !='0'){
     if(_this.feeForm.occupiedFee ==null || _this.feeForm.occupiedFee ==''){alert("占位费金额不能为空！");return false}}
    //  if(_this.feeForm.occupiedTime !='0'){
    //  if(_this.feeForm.occupiedTime ==null || _this.feeForm.occupiedTime ==''){alert("占位时间不能为空！");return false}}
     if(_this.feeForm.amount !='0'){
     if(_this.feeForm.amount ==null || _this.feeForm.amount ==''){alert("支付金额不能为空！");return false}}
     if(_this.feeForm.firstElectricityNum !='0'){
     if(_this.feeForm.firstElectricityNum ==null || _this.feeForm.firstElectricityNum ==''){alert("尖不能为空！");return false}}
     if(_this.feeForm.secondElectricityNum !='0'){
     if(_this.feeForm.secondElectricityNum ==null || _this.feeForm.secondElectricityNum ==''){alert("峰不能为空！");return false}}
     if(_this.feeForm.thirdElectricityNum !='0'){
     if(_this.feeForm.thirdElectricityNum ==null || _this.feeForm.thirdElectricityNum ==''){alert("平不能为空！");return false}}
     if(_this.feeForm.fourthElectricityNum !='0'){
     if(_this.feeForm.fourthElectricityNum ==null || _this.feeForm.fourthElectricityNum ==''){alert("谷不能为空！");return false}}
     if(_this.feeForm.electricityNum !='0'){
     if(_this.feeForm.electricityNum ==null || _this.feeForm.electricityNum ==''){alert("历史总电量不能为空！");return false}}
     if(_this.feeForm.payWays !='0'){
     if(_this.feeForm.payWays ==null || _this.feeForm.payWays ==''){alert("支付方式不能为空！");return false}}
     if(_this.feeForm.stopReason ==null || _this.feeForm.stopReason ==''){alert("停止原因不能为空！");return false}
     if(_this.feeForm.exceptionCode ==null || _this.feeForm.exceptionCode ==''){alert("异常代码不能为空！");return false}
     if(_this.feeForm.status !='0'){
     if(_this.feeForm.status ==null || _this.feeForm.status ==''){alert("充电状态不能为空！");return false}}

  
      setlockApi(data)
        .then(function (resp) {
          if (resp.errmsg === "ok") {
            _this.OccAmount = resp.data;      
            _this.addDialog = false;
            _this.addDialog4 = true;

          }
        })
        .catch(function (resp) {
          _this.$notify({
            title: "失败",
            message: "修改失败，请稍后重试。",
            type: "error",
          });
        });
 
    },

    localTime(){
        var _this = this;
       var date=new Date();
                var year=date.getFullYear();
                var month= date.getMonth()+1<10 ? "0"+(date.getMonth()+1) : date.getMonth()+1;
                var day=date.getDate()<10 ? "0"+date.getDate() : date.getDate();
                var hours=date.getHours()<10 ? "0"+date.getHours() : date.getHours();
                var minutes=date.getMinutes()<10 ? "0"+date.getMinutes() : date.getMinutes();
                var seconds=date.getSeconds()<10 ? "0"+date.getSeconds() : date.getSeconds();
                // 拼接
                var localTime = year+"-"+month+"-"+day+" "+hours+":"+minutes+":"+seconds;

                _this.leaveTimeTemp = localTime
      },

    Channelcheck2() {
      var _this = this;
      const data = {
            id:_this.feeForm.id,
            openId:_this.feeForm.userId,
            orderId:_this.feeForm.orderId,
            lockMac:_this.feeForm.lockMac,
            occTime:_this.feeForm.occupiedTime,
            occFee:Math.abs(_this.feeForm.occupiedFee),
            type:_this.feeForm.occupiedFee > 0 ? 1 :0,
            ip:_this.ip
      };

     if(_this.feeForm.id ==null || _this.feeForm.id ==''){alert("id不能为空！");return false;}
     if(_this.feeForm.userId ==null || _this.feeForm.userId ==''){alert("open_id不能为空！");return false;}
     if(_this.feeForm.orderId ==null || _this.feeForm.orderId ==''){alert("订单号不能为空！");return false;}
     if(_this.feeForm.lockMac ==null || _this.feeForm.lockMac ==''){alert("mac地址不能为空！");return false;}
     if(_this.feeForm.occupiedFee !='0'){
     if(_this.feeForm.occupiedFee ==null || _this.feeForm.occupiedFee ==''){alert("占位费金额不能为空！");return false}}

  
     lcoccfeeprocApi(data).then(function (resp) {
          if (resp.errmsg === "ok") {

            _this.$notify({
              title: "退款成功",
              message: "修改成功",
              type: "success",
            });

        //     if(_this.feeForm.occupiedFee > 0){
        //  lcoccfeeprocrefundApi({
        //     openId:_this.feeForm.userId,
        //     orderId:_this.feeForm.orderId,
        //     occMoney:_this.feeForm.occupiedFee,
        //     ip:_this.ip
        //   }).then(function (resp) {
        //     if (resp.errmsg === "ok") {
        //     _this.$notify({
        //       title: "退款成功",
        //       message: "修改成功",
        //       type: "success",
        //     });
        //   }else if(resp.errmsg === "refund.fail"){
        //     _this.$notify({
        //     title: "退款失败",
        //     message: "修改失败，请稍后重试。",
        //     type: "error",
        //   });
        //   }
        //   })
        //   .catch(function (resp) {
        //   _this.$notify({
        //     title: "退款失败",
        //     message: "修改失败，请稍后重试。",
        //     type: "error",
        //   });
        // });
        //  }else{
        //   _this.$notify({
        //       title: "退款成功",
        //       message: "修改成功",
        //       type: "success",
        //     });
        //  }
            _this.queryBtn();
            _this.addDialog2 = false;

          }else{
            _this.$notify({
            title: "退款失败",
            message: "修改失败，请稍后重试。",
            type: "error",
          });

          }
        })
        .catch(function (resp) {
          _this.$notify({
            title: "退款失败",
            message: "修改失败，请稍后重试。",
            type: "error",
          });
        });

      },


    Channelcheck3() {
      var _this = this;
      const data = {
        faultNo:_this.feeForm.faultNo,
        lockMac:_this.feeForm.lockMac,
        lockName:_this.feeForm.lockName.replace(/\r+|\n+| +/g, ''),
        faultDesc:_this.feeForm.faultDesc.replace(/\r+|\n+| +/g, ''),
        procMethod:_this.feeForm.procMethod.replace(/\r+|\n+| +/g, ''),
        faultSource:_this.feeForm.faultSource,
        isReport:_this.feeForm.isReport == false ? 0 : 1,
        opPerson:_this.feeForm.opPerson.replace(/\r+|\n+| +/g, ''),
      };

     if(_this.feeForm.faultNo ==null || _this.feeForm.faultNo ==''){alert("项目编号不能为空！");return false;}
     if(_this.feeForm.lockMac ==null || _this.feeForm.lockMac ==''){alert("mac地址不能为空！");return false;}
     if(_this.feeForm.lockName ==null || _this.feeForm.lockName ==''){alert("站点名称不能为空！");return false;}
     if(_this.feeForm.faultDesc ==null || _this.feeForm.faultDesc ==''){alert("问题描述不能为空！");return false;}
     if(_this.feeForm.procMethod ==null || _this.feeForm.procMethod ==''){alert("解决方案不能为空！");return false;}
     if(_this.feeForm.faultSource !='0'){
     if(_this.feeForm.faultSource ==null || _this.feeForm.faultSource ==''){alert("问题来源不能为空！");return false;}}
     if(_this.feeForm.opPerson ==null || _this.feeForm.opPerson ==''){alert("推送人员不能为空！");return false;}
    
  
     lcfaultprocApi(data).then(function (resp) {
          if (resp.errmsg === "ok") {
            _this.$notify({
              title: "成功",
              message: "修改成功",
              type: "success",
            });
            _this.queryBtn();
            _this.addDialog3 = false;

          }
        })
        .catch(function (resp) {
          _this.$notify({
            title: "失败",
            message: "修改失败，请稍后重试。",
            type: "error",
          });
        });
      },



    procRefund(index, row, status) {
      let _this = this;
      _this.loading = true;
      procRefundApi(row.id, status).then((resp) => {
        console.log(resp);
        _this.loadAbnormalOrder(this.pageNo, this.pageSize);
        _this.$notify({
          title: "成功",
          message: "已处理",
          type: "success",
        });
      });
    },



    handlePageChange(pageSize) {



      var _this = this;
      _this.pageSize = pageSize;
  

      // if(_this.queryParams.mac != '' || _this.queryParams.userId !='' || _this.queryParams.phone != ''){
      //   this.queryBtn();
      // }else{


      if (_this.checkVal == 1) {
        _this.loading = true;
        loadAbnormalListApi(
          {pageNo: this.pageNo, pageSize:this.pageSize,roleCode:this.roleCode}
        ).then((resp) => {
          if (resp.errmsg === "ok") {
            _this.total = resp.data.totalNum;
            _this.list = resp.data.dataList;
          }
          setTimeout(() => {
            _this.loading = false;
          }, 1 * 1000);
        });
       
      }else if(_this.checkVal == 0)
      {
        this.loadAbnormalOrder(this.pageNo,pageSize);
      }else{
        _this.loading = true;
        loadAbnormalListlistHangup().then((resp) =>{
          if (resp.errmsg === "ok") {
            _this.total = resp.data.totalNum;
            _this.list = resp.data.dataList;
          }
          setTimeout(() => {
            let _this = this;
            _this.loading = false;
          }, 1 * 1000);
        })
      }
    
    },
    handleNoChange(pageNo) {
     
      var _this = this;
      _this.pageNo = pageNo;
      // console.log("111111111111111111",_this.queryParams.mac)
      // console.log("111111111111111111",_this.queryParams.userId)
      // console.log("111111111111111111",_this.queryParams.phone)
      // console.log("checkVal",_this.checkVal)

 


      if (_this.checkVal == 1) {
        _this.loading = true;
        loadAbnormalListApi(
          {pageSize: this.pageSize, pageNo:this.pageNo,roleCode:this.roleCode}
        ).then((resp) => {
          if (resp.errmsg === "ok") {
            _this.total = resp.data.totalNum;
            _this.list = resp.data.dataList;
          }
          setTimeout(() => {
            _this.loading = false;
          }, 1 * 1000);
        });
       
      }else if(_this.checkVal == 0)
      {
        this.loadAbnormalOrder(this.pageNo,this.pageSize);
      }else{
        _this.loading = true;
        loadAbnormalListlistHangup().then((resp) =>{
          if (resp.errmsg === "ok") {
            _this.total = resp.data.totalNum;
            _this.list = resp.data.dataList;
          }
          setTimeout(() => {
            let _this = this;
            _this.loading = false;
          }, 1 * 1000);
        })
      }
  
    },
    handleTableChange(val) {
      this.multipleSelection = val;
    },
    loadAbnormalOrder(pageNo, pageSize) {
      let _this = this;
      _this.loading = true;
      if(_this.queryParams.mac == ''){_this.queryParams.mac = null}
      if(_this.queryParams.userId == ''){_this.queryParams.userId = null}
      if(_this.queryParams.phone == ''){_this.queryParams.phone = null}

      loadAbnormalOrderApi({ pageNo: pageNo, pageSize: pageSize,
        userId:this.queryParams.userId,
        phone:this.queryParams.phone,
        mac:this.queryParams.mac
      
      }).then(
        (resp) => {
          if (resp.errmsg === "ok") {
            console.log(resp.data.dataList);
            _this.total = resp.data.totalNum;
            _this.list = resp.data.dataList;
          }
          setTimeout(() => {
            _this.loading = false;
          }, 1 * 1000);
        }
      );
    },
    loadParkfieldApi() {
      let _this = this;
      _this.loading = true;
      loadParkfieldApi().then((resp) => {
        _this.parkfieldList = resp.data.dataList;
        console.log(_this.parkfieldList);
        _this.loading = false;
      });
    },

    getIP(){
      var xmlhttp;
            if (window.XMLHttpRequest) {
                xmlhttp = new XMLHttpRequest();
            } else {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.open("get","https://api.ipify.org?format=json", false);
            xmlhttp.send();
            var item = JSON.parse(xmlhttp.responseText);
            this.ip = item.ip
            console.log("llllllllllll",this.ip)
    },


    rowClassName({ row,  rowIndex }) {
          let rowName = "",
          findRow = this.selectionRow.find(c => c.rowIndex === row.rowIndex);
         if (findRow) {
           rowName = "current-row "; // elementUI 默认高亮行的class类 不用再样式了^-^,也可通过css覆盖改变背景颜色
      }
    return rowName; //也可以再加上其他类名 如果有需求的话
 },


    queryBtn() {
      let _this = this;
      _this.loading = true;

      if(_this.queryParams.mac == ''){_this.queryParams.mac = null}
      if(_this.queryParams.userId == ''){_this.queryParams.userId = null}
      if(_this.queryParams.phone == ''){_this.queryParams.phone = null}
      this.checked = '所有订单'
      this.checkVal = 0
      this.pageNo = 1
      loadAbnormalOrderApi({
        pageNo: _this.pageNo,
        pageSize: _this.pageSize,
        mac: _this.queryParams.mac,
        userId: _this.queryParams.userId,
        phone: _this.queryParams.phone == null ? null : _this.queryParams.phone.replace(/\s*/g, "")
      }).then((resp) => {
        _this.lcredepositrequests = resp.data;
        _this.total = resp.data.totalNum;
        _this.list = resp.data.dataList;
        _this.loading = false;
      });
    },
  },
  computed: {
    userState() {
      return getNickName() === getTestUserName();
    },
  },
  mounted: function () {
    let _this = this;
    _this.roleCode = getRoleCode();
 
    this.$nextTick(function () {
      // this.loadAbnormalOrder(_this.pageNo, _this.pageSize);
      loadAbnormalListApi(
        {pageNo: this.pageNo, pageSize: this.pageSize,roleCode:this.roleCode}
      ).then((resp) => {
          if (resp.errmsg === "ok") {
            // console.log(resp.data.dataList);
            _this.total = resp.data.totalNum;
            _this.list = resp.data.dataList;
          }
          setTimeout(() => {
            _this.loading = false;
          }, 1 * 1000);
        });
    });
  },
};
</script>

<style scoped>






.page-tool div {
  text-align: right;
}

.lock-btn {
  margin-bottom: 5px;
  margin-top: -10px;
}
.operateBtn {
  font-size: 18px;
  width: 32px;
  height: 32px;
  padding: 0;
}



</style>